/*Copyright (C) 2009 - 2011 MASSART GAUTHIER

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "headers.h"

short CT = COLOR_CYAN, CS = COLOR_RED, CTS = COLOR_GREEN, CBS = COLOR_BLUE;
short volume_musique = 60, volume_son = 60;
char prenom[100];
short type_menu = 2;
short touche_haut = KEY_UP, touche_bas = KEY_DOWN, touche_droite = KEY_RIGHT, touche_gauche = KEY_LEFT, ok = 0, teste = 0;
const char version_jeu[] = " 1.5.0";
bool animation_menu = true, animations_bienvenue_fin = true, i_bienvenue = false, verif_maj_start = true;


int main(int argc, char *argv[]) {
	char *contenu_menu = "*Jeux :\n"
											 "Jeu du plus ou moins\n"
											 "Jeu du pendu\n"
											 "Jeu du pousse caisses\n"
											 "Jeu du morpion\n"
											 "Jeu du snake\n"
											 "Jeu du chifumi\n"
											 "Jeu des tours de hanoi\n"
											 "Jeu du bantumi\n"
											 "Jeu du tetris\n"
											 "Jeu du tower build\n"
											 "Jeu du pong\n"
											 "Jeu du excit\n"
											 "Jeu du puissance 4\n"
											 //"Jeu du reversi\n"
											 "*Autres :\n"
											 "Crédits\n"
											 "Historiques\n"
											 "Options\n"
											 "Quitter\n"
											 "Gérer version.txt";

	char *contenu_titre = "MENU PRINCIPAL";
	short choix_menu = 0;
	list_menu menu_jeu[19] = {pom_menu, pendu_menu, pou_menu, morp_menu, snake_menu, chif_menu, hanoi_menu, ban_menu, tet_menu, cas_menu, pong_menu, excit_menu, pui_menu,/* rev_menu,*/ credit, historiques, options, quitter, creer_version_txt};

	if(argc > 0) {
		animations_bienvenue_fin = true;
	}
	else {
		animations_bienvenue_fin = false;
	}

	if(init_indemodables() == -1) {
		return -1;
	}

	i_bienvenue = animations_bienvenue_fin;

	while(choix_menu != 17) {
		if(!i_bienvenue) {
			clear();
			bienvenue_2();
		}
		else
			i_bienvenue = false;

		choix_menu = afficher_menu_jeu(contenu_menu, contenu_titre);

		menu_jeu[choix_menu-1]();
	}

	close_gest_sons();
	endwin();

	return 0;
}
